<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src="player/flowplayer-3.1.4.js"></script>

</head>
<!-- set black background, and white text, don't use default because this looks better -->
<body text="#FFFFFF" bgcolour="#000000">

<div style="display:block;width:100%;height:100%;" id="myPlayer">
	<!-- splash image inside the container, will show up in IE, and temporarily in other browsers before starting Media player -->
	<center>
	<img src="media/Gold_Lion.jpg" alt="Search engine friendly content">
	</center>
</div>
<script>
// setup player 
$f("myPlayer", "player/flowplayer-3.1.5.swf", {

	// common clip: these properties are common to each clip in the playlist
	clip: { 
		//this next function is run in the last second of the clip.
		onLastSecond : function(){
			
			var i = $f("myPlayer").getClip();
			
			if( i == $f("myPlayer").getClip( $f("myPlayer").getPlaylist().length-1) ){
				//last clip is being played now.
				//restart the playlist, the 750ms is assigned bassed on trial and error.
				//it happens to be long enough to restart the media with no obvious delay.
				setTimeout("$f(\"myPlayer\").play();",750);
			}
		},
		scaling: 'fit',//fit the media to screen, enlarge, keep aspect ratio
		autoPlay: true, //automatically play
        autoBuffering: true //start to load things early.
	},
	
	// playlist with four entries
	playlist: [
	
<?php

	//default duration : pictures
	$def_Len = 4;

	//for video
	$item = array();
	$fh = fopen("data/playlist_v.txt", "r");
	$i=0;
	//read the file, and load each line
	while(!feof($fh))
	{
		$tmp = trim(fgets($fh));
		if(strlen($tmp) >5){
			$item[$i]= $tmp;
			$i++;
		}
		
	}
	//echo "-".sizeof($item)."-";
	fclose($fh);
	
	for($i = 0; $i < sizeof($item); $i++){
		echo "{url: '".$item[$i]."'}, \n";//print out each line
	}
	
	
	//Pictures
	$item;
	$fh = fopen("data/playlist_p.txt", "r");
	$i=0;
	//load the pictures line by line
	while(!feof($fh))
	{
		$tmp = trim(fgets($fh));
		if(strlen($tmp) >5){
			$item[$i]= $tmp;
			$i++;
		}
		
	}
	fclose($fh);
	
	//format the pictures so that they show up properly and have the default duration
	for($i = 0; $i < sizeof($item)-1; $i++){
	//replace the semicolon that we put in to delimit duration
		$temp = str_replace(";", "', duration: ", $item[$i]);
		if( strpos($item[$i],";") <= 0){
		//if there is no semicolon, then set default duration
			$temp = $item[$i] . "', duration: ".$def_Len;
		}
		echo "{url: '".$temp."}, \n";//print it out
	}
	
	//the last item doesn't need a comma at the end, and will cause problems if there is.
	///therefore we do the last media picture seperatly.
	$temp = str_replace(";", "', duration: ", $item[sizeof($item)-1]);
	if( strpos($item[sizeof($item)-1],";") <= 0){
		$temp = $item[sizeof($item)-1] . "', duration: ".$def_Len;
	}
	echo "{url: '".$temp."} \n";//print out last file
	
	?>

	],
	
	// show playlist buttons in controlbar
	plugins:  {
		controls:null//remove this line to show the default media controls, play, pause, stop, forward, back, seek, fullscreen.
	},
	canvas: {
		backgroundColor:'#000000',//set background to black
		backgroundGradient: 'none'//set the background to have no shade gradient, ex fade from black to white (from top to bottom)
	}
});

//following code autostarts the media player after a wait of about 1 minute, only if not viewed in IE
if ( navigator.appName != "Microsoft Internet Explorer" )
{
	setTimeout('$f("myPlayer").play()',1000*60);
}

</script>
<noscript>* Please enable javascript, this page will not display properly with out it.</noscript>
</body></html>
